<?php
namespace V1;
class C_Enterprisestyle extends \ResourceClass
{
    public $isActive = true;
    public $remark = '企业风采';

    public function get(array $req, array $post, &$result)
    {
        if (!isset($req['uid'])) {
            return 'require user uid';
        }
        if (!isset($req['userType'])) {
            return 'require user type';
        }
        if (!isset($req['k']) || !isset($req['t'])) {
            return 'data error';
        }

        if (!isset($req['enterpriseId'])) {
            return 'require enterprise id';
        }

        if (\Biz\UserHandler::checkAuth($req['userType'], $req['uid'], $req['enterpriseId'], $req['t'], $req['k']) !== true) {
            return 'data illegal';
        }

        $host = $_SERVER['SERVER_NAME'];
        if (strpos($host,'test') != 0) {
            $result['url'] = "http://enterprise.test.freshqiao.com/login/style?enterprise_id=".$req['enterpriseId'];
        } else if (strpos($host,'dev') != 0) {
            $result['url'] = "http://enterprise.dev.freshqiao.com/login/style?enterprise_id=".$req['enterpriseId'];
        } else {
            $result['url'] = "http://enterprise.freshqiao.com/login/style?enterprise_id=".$req['enterpriseId'];
        }
    }
}